Skip to content

OCPBUGS-81745: [release-4.21] Honor AWS AMI override in NodePool token generation - #8170

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.21from
bryan-cox:cherry-pick-OCPBUGS-81745-to-release-4.21
Apr 8, 2026
Merged

OCPBUGS-81745: [release-4.21] Honor AWS AMI override in NodePool token generation#8170
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.21from
bryan-cox:cherry-pick-OCPBUGS-81745-to-release-4.21

Conversation

@bryan-cox

Copy link
Copy Markdown
Member

Summary

Manual backport of #7675 to release-4.21 — the automated cherry-pick failed due to merge conflicts in token.go.

On release-4.21, the karpenter label code was refactored to use t.userData.ami (computed in NewToken()), so the fix was adapted to check the AMI override in NewToken() rather than in the label-setting code path.

Changes

  • token.go: Check nodePool.Spec.Platform.AWS.AMI before falling back to defaultNodePoolAMI() in NewToken()
  • nodepool_controller.go: Add nil check for releaseImage.StreamMetadata in defaultNodePoolAMI()
  • nodepool_controller_test.go: Add test case for nil StreamMetadata scenario

References

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Apr 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request references Jira Issue OCPBUGS-81745, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.z) matches configured target version for branch (4.21.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-76350 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-76350 targets the "4.22.0" version, which is one of the valid target versions: 4.22.0
  • bug has dependents

No GitHub users were found matching the public email listed for the QA contact in Jira (jiezhao@redhat.com), skipping review request.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

Manual backport of #7675 to release-4.21 — the automated cherry-pick failed due to merge conflicts in token.go.

On release-4.21, the karpenter label code was refactored to use t.userData.ami (computed in NewToken()), so the fix was adapted to check the AMI override in NewToken() rather than in the label-setting code path.

Changes

  • token.go: Check nodePool.Spec.Platform.AWS.AMI before falling back to defaultNodePoolAMI() in NewToken()
  • nodepool_controller.go: Add nil check for releaseImage.StreamMetadata in defaultNodePoolAMI()
  • nodepool_controller_test.go: Add test case for nil StreamMetadata scenario

References

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from csrwng and devguyio April 6, 2026 17:44
@openshift-ci openshift-ci Bot added the area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release label Apr 6, 2026
@openshift-ci

openshift-ci Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Apr 6, 2026
@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ba13bd59-876e-4198-8d63-77e7409541bb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

…n generation

Backport of openshift#7675 to release-4.21.

The NewToken() function always called defaultNodePoolAMI() without
checking if a user-specified AMI override was set via
nodePool.Spec.Platform.AWS.AMI. This caused failures in AWS ISO
(classified) regions where release image metadata may not contain
region data, and users must specify a custom AMI.

This fix checks for the AMI override before falling back to
defaultNodePoolAMI(), and adds a nil check for StreamMetadata to
prevent nil pointer dereference when stream metadata is unavailable.
@bryan-cox
bryan-cox force-pushed the cherry-pick-OCPBUGS-81745-to-release-4.21 branch from 7c9ffd7 to 9011e64 Compare April 6, 2026 20:20
@enxebre

enxebre commented Apr 7, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2026
@jiezhao16

Copy link
Copy Markdown

/verified by @jiezhao16

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@jiezhao16: This PR has been marked as verified by @jiezhao16.

Details

In response to this:

/verified by @jiezhao16

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@enxebre enxebre added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Apr 8, 2026
@bryan-cox

Copy link
Copy Markdown
Member Author

/test e2e-azure-aks-external-oidc

@openshift-ci

openshift-ci Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit b722bf6 into openshift:release-4.21 Apr 8, 2026
17 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: Jira Issue Verification Checks: Jira Issue OCPBUGS-81745
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-81745 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Summary

Manual backport of #7675 to release-4.21 — the automated cherry-pick failed due to merge conflicts in token.go.

On release-4.21, the karpenter label code was refactored to use t.userData.ami (computed in NewToken()), so the fix was adapted to check the AMI override in NewToken() rather than in the label-setting code path.

Changes

  • token.go: Check nodePool.Spec.Platform.AWS.AMI before falling back to defaultNodePoolAMI() in NewToken()
  • nodepool_controller.go: Add nil check for releaseImage.StreamMetadata in defaultNodePoolAMI()
  • nodepool_controller_test.go: Add test case for nil StreamMetadata scenario

References

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox
bryan-cox deleted the cherry-pick-OCPBUGS-81745-to-release-4.21 branch April 8, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants